# @文件:  D:/PycharmProjects/pythonProject/01_Module_C/auto_test_01\main.py
# @作者:    邱剑萍
# @创建时间:    2025/4/8 22:47
import os

import pandas

file_path = r'D:\PycharmProjects\pythonProject\01_Module_C\自动化测试用例_01.xlsx'
excel_file = pandas.ExcelFile(file_path)
df = pandas.read_excel(file_path,sheet_name='Sheet1')
print('列名',df.columns.tolist())
print('前五行数据：\n',df.head())
print('总行书：',len(df))

try:
  if df.empty:
        print("DataFrame 为空，请检查 Excel 文件内容！")
  else:
        records = df.to_dict('records')
        for record in records:
            print(record,'\n')
except Exception as e:
    print("读取失败，错误信息:", str(e))